package command

import (
	uuid "github.com/satori/go.uuid"
	"ssadmin/internal/admin/models"
)

type SysDictTypeInsertReq struct {
	Id       string `uri:"id"`
	DictName string `json:"dictName"`
	DictType string `json:"dictType"`
	Status   int    `json:"status"`
	Remark   string `json:"remark"`
	SystemId string `json:"systemId"`
	BizId    string `json:"bizId"`
	ControlBy
}

func (s *SysDictTypeInsertReq) Generate(model *models.SysDictType) {
	if len(s.Id) != 0 {
		model.ID = s.Id
	} else {
		s.Id = uuid.NewV4().String()
		model.ID = s.Id
	}
	model.DictName = s.DictName
	model.DictType = s.DictType
	model.Status = s.Status
	model.Remark = s.Remark
	model.SystemId = s.SystemId
	model.BizId = s.BizId
	model.CreateBy = s.CreateBy

}

func (s *SysDictTypeInsertReq) GetId() interface{} {
	return s.Id
}

type SysDictTypeUpdateReq struct {
	Id       string `uri:"id"`
	DictName string `json:"dictName"`
	DictType string `json:"dictType"`
	Status   int    `json:"status"`
	Remark   string `json:"remark"`
	SystemId string `json:"systemId"`
	BizId    string `json:"bizId"`
	ControlBy
}

func (s *SysDictTypeUpdateReq) Generate(model *models.SysDictType) {
	if len(s.Id) != 0 {
		model.ID = s.Id
	}
	model.DictName = s.DictName
	model.DictType = s.DictType
	model.Status = s.Status
	model.Remark = s.Remark
	model.SystemId = s.SystemId
	model.BizId = s.BizId

}

func (s *SysDictTypeUpdateReq) GetId() interface{} {
	return s.Id
}

type SysDictTypeDeleteReq struct {
	Ids []string `json:"ids"`
	ControlBy
}

func (s *SysDictTypeDeleteReq) GetId() interface{} {
	return s.Ids
}

type ControlBy struct {
	CreateBy string `json:"createBy" gorm:"index;comment:创建者"`
	UpdateBy string `json:"updateBy" gorm:"index;comment:更新者"`
}
